package 并发编程16.消息发送场景;

import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author idea
 * @data 2019/2/10
 */
public class Demo {

    public static void main(String[] args) {
        DelayQueue<Message> queue=new DelayQueue<>();
        Message m1=new Message(1,"hello",300000000);
        Message m2=new Message(2,"hello2",1000000000);
        queue.offer(m1);
        queue.offer(m2);
        ExecutorService executorService= Executors.newFixedThreadPool(2);
        executorService.execute(new Consumer(queue));
        executorService.shutdown();

    }
}
